package org.jivesoftware.smackx.muc;

import java.util.Iterator;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.FormField;
import org.jivesoftware.smackx.packet.DiscoverInfo;

public class RoomInfo
{
  private String description = "";
  private boolean membersOnly;
  private boolean moderated;
  private boolean nonanonymous;
  private int occupantsCount;
  private boolean passwordProtected;
  private boolean persistent;
  private String room;
  private String subject = "";

  RoomInfo(DiscoverInfo paramDiscoverInfo)
  {
    this.occupantsCount = -1;
    this.room = paramDiscoverInfo.getFrom();
    this.membersOnly = paramDiscoverInfo.containsFeature("muc_membersonly");
    this.moderated = paramDiscoverInfo.containsFeature("muc_moderated");
    this.nonanonymous = paramDiscoverInfo.containsFeature("muc_nonanonymous");
    this.passwordProtected = paramDiscoverInfo.containsFeature("muc_passwordprotected");
    this.persistent = paramDiscoverInfo.containsFeature("muc_persistent");
    Form localForm = Form.getFormFrom(paramDiscoverInfo);
    if (localForm != null)
    {
      this.description = ((String)localForm.getField("muc#roominfo_description").getValues().next());
      Iterator localIterator = localForm.getField("muc#roominfo_subject").getValues();
      if (!(localIterator.hasNext()))
        break label167;
      this.subject = ((String)localIterator.next());
    }
    while (true)
    {
      this.occupantsCount = Integer.parseInt((String)localForm.getField("muc#roominfo_occupants").getValues().next());
      return;
      label167: this.subject = "";
    }
  }

  public String getDescription()
  {
    return this.description;
  }

  public int getOccupantsCount()
  {
    return this.occupantsCount;
  }

  public String getRoom()
  {
    return this.room;
  }

  public String getSubject()
  {
    return this.subject;
  }

  public boolean isMembersOnly()
  {
    return this.membersOnly;
  }

  public boolean isModerated()
  {
    return this.moderated;
  }

  public boolean isNonanonymous()
  {
    return this.nonanonymous;
  }

  public boolean isPasswordProtected()
  {
    return this.passwordProtected;
  }

  public boolean isPersistent()
  {
    return this.persistent;
  }
}